package inventory.daoImplementer;

import java.sql.SQLException;

import dbhandelling.Crude;
import dto.MaterialBalance;
import inventory.daoInterface.MaterialBalanceDao;


public class MaterialBalanceImplementor extends Crude implements MaterialBalanceDao
{
	
	@Override
	public void add(MaterialBalance materialBalance) throws Exception 
	{
		insert(materialBalance);
	}

	@Override
	public void update(MaterialBalance materialBalance) throws Exception 
	{
		
	}

	@Override
	public void delete(MaterialBalance materialBalance) throws Exception 
	{
		
	}

	@Override
	public MaterialBalance retreive(String conditionField, String ConditionValue) throws Exception 
	{
		MaterialBalance materialBalance=(MaterialBalance) super.retreive("MaterialBalance",conditionField, ConditionValue);
		return materialBalance;
	}

	@Override
	public MaterialBalance[] retreiveArray(String conditionField, String conditionValue) throws Exception 
	{
		MaterialBalance[] materialBalances;
		Object[] obj=super.retreiveArrayOnCondition("MaterialBalance", conditionField, conditionValue);
		materialBalances=new MaterialBalance[obj.length];
		
		for(int i=0;i<materialBalances.length;i++)
		{
			materialBalances[i]=(MaterialBalance) obj[i];
		}
		
		return materialBalances;
	}

	@Override
	public MaterialBalance[] retreiveAll() throws Exception 
	{
		MaterialBalance[] materialBalances;
		
		Object[] obj=super.retreiveAll("MaterialBalance");
		
		materialBalances=new MaterialBalance[obj.length];
		
		for(int i=0;i<materialBalances.length;i++)
		{
			materialBalances[i]=(MaterialBalance) obj[i];
		}
		
		return materialBalances;
	}

}
